﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ActiveStory.UI
{
    /// <summary>
    /// Interaction logic for CanvasSizeDialog.xaml
    /// </summary>
    public partial class CanvasSizeDialog : Window
    {
        /// <summary>
        /// Size of the canvas
        /// </summary>
        private Point _canvasSize;

        public Point CanvasSize
        {
            get
            {
                return _canvasSize;
            }
        }
        public Boolean SetDefault
        {
            get
            {
                return (bool)SetDefaultChecBox.IsChecked;
            }
        }

        public CanvasSizeDialog(Point currentCanvasSize)
        {
            InitializeComponent();
            _canvasSize = currentCanvasSize;
            CanvasWidthTextBox.Text = _canvasSize.X.ToString("N2");
            CanvasHeightTextBox.Text = _canvasSize.Y.ToString("N2");
        }

        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _canvasSize = new Point(double.Parse(CanvasWidthTextBox.Text), double.Parse(CanvasHeightTextBox.Text));
                DialogResult = true;
            }
            catch
            {
                MessageBox.Show(this, "Invalid canvas dimensions. Dimensions must be positive numbers.", "Invalid Canvas Dimensions", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
    }
}
